<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <my-header txt='书影音' src1='img/bg.png' src2='img/bg.png'></my-header>
        <my-header txt='广播' src1='img/bg.png' src2='img/bg.png'></my-header>
        <my-header txt='小组' src1='img/bg.png' src2='img/bg.png'></my-header>
        <my-header txt='我的' src1='img/bg.png' src2='img/bg.png'></my-header>
    </div>
    <!-- 定义组件模板 -->
    <template id="head">
        <div class="headerWrap">
            <span>{{txt}}</span>
            <img :src="src1" class="leaftImg"/>
            <img :src="src2" class="rightImg" />
        </div>
    </template>
</body>
<script>
    var vm = new Vue({
        el: "#app",
        data: {

        },
        components: {
            'myHeader': {
                template: '#head',
                props: ['txt', 'src1', 'src2'],
            }
        }
    });
</script>

</html>